package com.liruo.learn.spring.mvc.err;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

/**
 * @Author:liruo
 * @Date:2023-05-11-17:01:36
 * @Desc
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResp <T>{
    private int code;
    private T data;
    public static BaseResp<String> fail(int code, String msg){
        return new BaseResp<>(code, msg);
    }
    public static BaseResp<String> fail(HttpStatus httpStatus){
        return new BaseResp<>(httpStatus.value(), httpStatus.getReasonPhrase());
    }
}
